# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_gnome_4_giant_session_id'
  
  private #---------------------------------------------------------------------------------

  def authorize_access
    unless session[:user_id] && session[:user_level] == 1
      flash[:notice] = "Please log in."
      redirect_to(:controller => 'admin', :action => 'index')
      return false
    end  
  end
  
  def authorize_public_access
    unless session[:user_id]
      flash[:notice] = "Please log in."
      redirect_to(:controller => 'public', :action => 'index')
      return false
    end  
  end

end